const generate = numRows => {
  let res = [[1]]
  for (let i = 1; i < numRows; i++) {
    let arr = new Array(i + 1).fill(1)
    for (let j = 1; j < i; j++) {
      console.log([i - 1][j - 1], '+++++++');
      console.log(res[i - 1][j], '---------');
      arr[j] = res[i - 1][j - 1] + res[i - 1][j]
      // console.log(arr[j], '========');
    }
    res.push(arr)
  }
  return res
}
// generate(5)
console.log(generate(3));